package de.mmis.core.tuplespace;

/**
 * general tuplespace container providing basic methods every container needs
 * 
 * @author Christian Koch
 * 
 */
public abstract class TuplespaceContainer {
	protected final static long DEFAULT_LEASETIME = Long.MAX_VALUE;
	protected final static long DEFAULT_TIMEOUT = 10000;

	protected final long timeout;
	protected final long leaseTime;
	
	public TuplespaceContainer()
	{
		this(DEFAULT_TIMEOUT,DEFAULT_LEASETIME);
	}
	
	public TuplespaceContainer(long timeout)
	{
		this(timeout,DEFAULT_LEASETIME);
	}
	
	public TuplespaceContainer(long timeout, long leaseTime)
	{
		this.timeout=timeout;
		this.leaseTime=leaseTime;
	}

	/**
	 * @return time span to wait for tuplespace to return tuples read or taken
	 */
	public long getTimeout() {
		return timeout;
	}

	/**
	 * @return time to live between two consecutive writing operations on this container
	 */
	public long getLeaseTime() {
		return leaseTime;
	}
}
